<template>
  <div id="context-menu"
       :style="{left:`${comtextMenuPos.x}px`,top:`${comtextMenuPos.y}px`,}">
    <div class="context-menu-item"
         @click="emitContextMenuFunc(0)">
      <span>删除</span>
      <i class="el-icon-delete"></i>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    comtextMenuPos: {
      type: Object,
    },
    id: {
      type: String,
    },
  },
  setup (props, { emit }) {
    console.log(props);
    function emitContextMenuFunc (type) {
      emit('emitContextMenuFunc', type, props.id);
    }
    return {
      emitContextMenuFunc,
    };
  },
};
</script>

<style lang="scss" scoped>
#context-menu {
  position: absolute;
  width: 100px;
  background: hsl(0deg 0% 96%);
  border-radius: 4px;
  padding: 6px;
  font-size: 14px;
  text-align: left;
}
.context-menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 4px;
  &:hover {
    background: lightblue;
  }
}
</style>
